function getCharsMapData(){
	$.ajax({
        type: "post",
        url: basePath+'/service/smzl/api/getCharsMapData',
        async: false,
        dataType: "json",
        success: function (map) {
        	var brower = []; 
        	$.each(map.data,function(i,item){
        		brower.push({
			                     name: item.city,
			                     value: item.count
			              	});
        	});
        	
        	optionMap = {
        			tooltip: {
	   		             trigger: 'item',
	   		             formatter: function (params) {
	   		            	 if(params.value){
	   		            		 return params.seriesName + '<br/>' + params.name + ' : ' + params.value;
	   		            	 }else{
	   		            		 return params.seriesName + '<br/>' + params.name + ' : ' + '0';
	   		            	 }
	   		             }
   		            },
        			visualMap: {
        				//type: 'piecewise',                  // 定义为分段型 visualMap
        		        //splitNumber:5,
        			    show:false, 
        			    min: 0,
        			    max: 80000,
        			    text:['高','低'],
        			    realtime: false,
        			    calculable: true,
        			    inRange: {
        			        color: ['orangered','yellow', 'lightskyblue']
        			    }
        			},
        			series: [
        			    {
        			        name: '关中清洁能源用户统计',
        			        type: 'map',
        			        mapType: 'HK', // 自定义扩展图表类型
        			        itemStyle:{
        			            normal:{label:{show:true}},
        			            emphasis:{label:{show:true}}
        			        },
        			        data:brower,
        			        }
        			    ]
        			};
        }
	});
	
}


function getCharsData(city,county){
	var bing = document.getElementById("bing");
	var myChartB = echarts.init(bing);
	$.ajax({
        type: "post",
        url: basePath+'/service/smzl/api/getCoalData?city='+encodeURI(city)+'&county='+county,
        async: false,
        dataType: "json",
        success: function (map) {
        	
        	/*$("#numZ").empty();$("#numQi").empty();$("#numDian").empty();$("#numJie").empty();
        	$("#numDi").empty();$("#numJi").empty();$("#numTai").empty();$("#numQi2").empty();
        	$("#finNum").empty();$("#finLv").empty();$("#yearPlan").empty();$("#yearFinNum").empty();$("#yearFinLv").empty();
        	
        	var numZ = '<font color="#007CD7" size="4px">'+map.data[0].count+'</font>';
        	$("#numZ").append(numZ);
        	var numQi = '<font color="#42C88C" size="4px">'+map.data[0].qi+'</font>';
        	$("#numQi").append(numQi);
        	var numDian = '<font color="#96C93E" size="4px">'+map.data[0].dian+'</font>';
        	$("#numDian").append(numDian);
        	var numJie = '<font color="#00B4D5" size="4px">'+map.data[0].jie+'</font>';
        	$("#numJie").append(numJie);
        	var numDi = '<font color="#007CD7" size="4px">'+map.data[0].di+'</font>';
        	$("#numDi").append(numDi);
        	var numJi = '<font color="#42C88C" size="4px">'+map.data[0].ji+'</font>';
        	$("#numJi").append(numJi);
        	var numTai = '<font color="#96C93E" size="4px">'+map.data[0].tai+'</font>';
        	$("#numTai").append(numTai);
        	var numQi2 = '<font color="#00B4D5" size="4px">'+map.data[0].qi2+'</font>';
        	$("#numQi2").append(numQi2);*/
        	var html= "";
        	$.each(map.data[1],function(i,item){
        		var count = Number(isNaN(item.dian)?0:item.dian)+Number(isNaN(item.qi)?0:item.qi)+Number(isNaN(item.di)?0:item.di)+Number(isNaN(item.jie)?0:item.jie)+Number(isNaN(item.ji)?0:item.ji)+Number(isNaN(item.tai)?0:item.tai)+Number(isNaN(item.qi2)?0:item.qi2);
        		var ccount = Number(isNaN(item.cdian)?0:item.cdian)+Number(isNaN(item.cqi)?0:item.cqi)+Number(isNaN(item.cdi)?0:item.cdi)+Number(isNaN(item.cjie)?0:item.cjie)+Number(isNaN(item.cji)?0:item.cji)+Number(isNaN(item.ctai)?0:item.ctai)+Number(isNaN(item.cqi2)?0:item.cqi2);
        		var ccountlv =  Math.round(ccount / count * 10000) / 100.00;
        		var cdianlv =  Math.round(item.cdian / item.dian * 10000) / 100.00;
        		var cqilv =  Math.round(item.cqi / item.qi * 10000) / 100.00;
        		var cjielv =  Math.round(item.cjie / item.jie * 10000) / 100.00;
        		var cdilv =  Math.round(item.cdi / item.di * 10000) / 100.00;
        		var cjilv =  Math.round(item.cji / item.ji * 10000) / 100.00;
        		var ctailv =  Math.round(item.ctai / item.tai * 10000) / 100.00;
        		var cqi2lv =  Math.round(item.cqi2 / item.qi2 * 10000) / 100.00;
        		html+="<tr><td rowspan='3'>"+item.district+"</td>"+
        			  "<td>累计数</td>"+
        			  "<td>"+count+"</td>"+
        			  "<td>"+item.dian+"</td>"+
        			  "<td>"+item.qi+"</td>"+
        			  "<td>"+item.jie+"</td>"+
        			  "<td>"+item.di+"</td>"+
        			  "<td>"+item.ji+"</td>"+
        			  "<td>"+item.tai+"</td>"+
        			  "<td>"+item.qi2+"</td></tr>"+
        			  "<tr><td>完成数</td>"+
        			  "<td>"+ccount+"</td>"+
        			  "<td>"+item.cdian+"</td>"+
        			  "<td>"+item.cqi+"</td>"+
        			  "<td>"+item.cjie+"</td>"+
        			  "<td>"+item.cdi+"</td>"+
        			  "<td>"+item.cji+"</td>"+
        			  "<td>"+item.ctai+"</td>"+
        			  "<td>"+item.cqi2+"</td></tr>"+
        			  "<tr><td>完成率</td>"+
        			  "<td>"+Number(isNaN(ccountlv)?0:ccountlv)+"%</td>"+
        			  "<td>"+Number(isNaN(cdianlv)?0:cdianlv)+"%</td>"+
        			  "<td>"+Number(isNaN(cqilv)?0:cqilv)+"%</td>"+
        			  "<td>"+Number(isNaN(cjielv)?0:cjielv)+"%</td>"+
        			  "<td>"+Number(isNaN(cdilv)?0:cdilv)+"%</td>"+
        			  "<td>"+Number(isNaN(cjilv)?0:cjilv)+"%</td>"+
        			  "<td>"+Number(isNaN(ctailv)?0:ctailv)+"%</td>"+
        			  "<td>"+Number(isNaN(cqi2lv)?0:cqi2lv)+"%</td></tr>"
        	});
        	$("#mapCount").empty();
	        $("#mapCount").append(html.replace(/undefined/g, "0"));
        	
        	optionB = {
        			title : {
        		        text: '煤改类型统计',
        		        x:'center'
        		    },
        		     grid:{
        		          top:'2%',
        				  containLabel:true
        		     },
        				
        		    tooltip: {
        		        trigger: 'item',
        		        formatter: "{a} <br/>{b}: {c} ({d}%)"
        		    },
        		    grid:{
        		    	top:'15px',
        		    },
        		    color:["#33CCCC","#94E61A","#ccffff","#9FB6CD","#FFDEAD","#9932CC","#9ACD32"],
        		    series: [
        		        {
        		            name:'煤改计划',
        		            type:'pie',
        		            radius: ['50%', '70%'],
        		            center:['50%','55%'],
        		            avoidLabelOverlap: false,
        		            label: {
        		                normal: {
        		                    show: false,
        		                    position: 'center'
        		                },
        		                emphasis: {
        		                    show: true,
        		                    textStyle: {
        		                        fontSize: '20',
        		                        fontWeight: 'bold'
        		                    }
        		                }
        		            },
        		            labelLine: {
        		                normal: {
        		                    show: false
        		                }
        		            },
        		            data:[
    			                {value:map.data[0].qi, name:'煤改气'},
    			                {value:map.data[0].dian, name:'煤改电'},
    			                {value:map.data[0].jie, name:'煤改洁净煤'},
    			                {value:map.data[0].di, name:'煤改地热'},
    			                {value:map.data[0].ji, name:'煤改集中供热'},
    			                {value:map.data[0].tai, name:'煤改太阳能'},
    			                {value:map.data[0].qi2, name:'其他'}
    			            ]
        		        }
        		    ]
        		};
        	if (city!=""){
        		optionB.title.text = city+'煤改类型统计';
        	}else {
        		optionB.title.text = '关中地区煤改类型统计';
	        }
        	// 饼图数据
        	myChartB.setOption(optionB);
        	
        	
        }
    });
}

// 煤改完成排行
function getFinData(city,county){
	$.ajax({
        type: "post",
        url: basePath+'/service/smzl/api/getFinData?city='+encodeURI(city)+'&county='+county,
        async: false,
        dataType: "json",
        success: function (map) {
        	$("#paihang").empty();
        	var html ="<ul>";
        	$.each(map.data,function(i){
        		var rownums = map.data[i].rownum;
        		var scale = map.data[i].scale;
            	if(scale==null){
            		scale=0;
            	}
    			switch(rownums){
    			case 1:
    			  html+="<li style='padding: 5px'><img src='"+basePath+"/ui/layui/images/dashboard/icon_金.png'></img>"
    				  +map.data[i].city+"<span class='numSpan'>"+Math.ceil(scale)+"%</span></li>";
    			  break;
    			case 2:
    				html+="<li style='padding: 5px'><img src='"+basePath+"/ui/layui/images/dashboard/icon_银.png'></img>"
      				  +map.data[i].city+"<span class='numSpan'>"+Math.ceil(scale)+"%</span></li>";
    			  break;
    			case 3:
    				html+="<li style='padding: 5px'><img src='"+basePath+"/ui/layui/images/dashboard/icon_铜.png'></img>"
      				  +map.data[i].city+"<span class='numSpan'>"+Math.ceil(scale)+"%</span></li>";
      			  break;
    			case 4:
    				html+="<li style='padding: 5px'><img style='padding-left: 5px;' src='"+basePath+"/ui/layui/images/dashboard/4.png'></img>   "
      				  +map.data[i].city+"<span class='numSpan'>"+Math.ceil(scale)+"%</span></li>";
      			  break;
    			case 5:
    				html+="<li style='padding: 5px'><img style='padding-left: 5px;' src='"+basePath+"/ui/layui/images/dashboard/5.png'></img>   "
      				  +map.data[i].city+"<span class='numSpan'>"+Math.ceil(scale)+"%</span></li>";
      			  break;
    			}
        	});
        	html += "</ul>";
        	$("#paihang").html(html);
        }
    });
}

//煤改完成率
function getCoalFin(city,county){
	var yibiao = document.getElementById("yibiao");
	var myChartC = echarts.init(yibiao);
	$.ajax({
        type: "post",
        url: basePath+'/service/smzl/api/getCoalFin?city='+encodeURI(city)+'&county='+county,
        async: false,
        dataType: "json",
        success: function (map) {
        	
        	var scale = map.data[0].scale;
        	if(scale==null){
        		scale=0;
        	}
        	
        	optionC = {
        			title : {
        		        text: '煤改完成率',
        		        x:'center'
        		    },
        		    tooltip : {
        		        formatter: "{a} <br/>{b} : {c}%"
        		    },
        		    series: [
        		        {	
        		        	startAngle: 180, //开始角度 左侧角度
        		        	endAngle: 0, //结束角度 右侧
        		            name: '煤改计划',
        		            type: 'gauge',
        		            detail: {formatter:'{value}%'},
        		            data:[
    			                {value:Math.ceil(scale)}
    			            ],
        		            center: ['50%', '65%'], // 默认全局居中
        		            axisLine: {            // 坐标轴线  
        	                     lineStyle: {       // 属性lineStyle控制线条样式  
        	                         color: [[0.2, '#63869e'], [0.8, '#91c7ae'], [1, '#42C88C']]
        	                                }  
        	                            },   
        		            label: {
        		                normal: {
        		                    show: false,
        		                    position: 'center'
        		                },
        		                emphasis: {
        		                    show: true,
        		                    textStyle: {
        		                        fontSize: '5',
        		                        fontWeight: 'bold'
        		                    }
        		                }
        		            },
        		        }
        		    ]
        		};
        	
        	if(city!=""){
        		optionC.title.text = city+'煤改完成率';
        	}else{
        		optionC.title.text = '关中地区煤改完成率';
        	}
        	// 仪表数据
        	myChartC.setOption(optionC);
        	
        	
        }
    });
}

//查询村级数据
function getMapData(city){
	
	var jsonArr = [];
	$.ajax({
        type: "post",
        url: basePath+'/service/smzl/api/getMapData?city='+encodeURI(city),
        async: false,
        dataType: "json",
        success: function (map) {
        	jsonArr = map.data;
        }
    });
	return jsonArr;
}



// 选项卡二
//洁净煤配送中心数据
function getMapJieJingData(city){
	
	var jsonArr = [];
	$.ajax({
        type: "post",
        url: basePath+'/service/smzl/api/getMapJieJingData?city='+encodeURI(city),
        async: false,
        dataType: "json",
        success: function (map) {
        	jsonArr = map.data;
        }
    });
	return jsonArr;
}
function getCharsMapData2(){
	$.ajax({
        type: "post",
        url: basePath+'/service/smzl/api/getCharsMapData2',
        async: false,
        dataType: "json",
        success: function (map) {
        	var brower = []; 
        	$.each(map.data,function(i,item){
        		brower.push({
			                     name: item.city,
			                     value: item.count
			              	});	
        	});
        	
        	optionMap2 = {
        			tooltip: {
        			    trigger: 'item',
        			    formatter: '{b}<br/>配送站个数：{c}'
        			},
        			visualMap: {
        			    min: 0,
        			    max: 10,
        			    show:false, 
        			    text:['高','低'],
        			    realtime: false,
        			    calculable: true,
        			    inRange: {
        					color: ['orangered','yellow', 'lightskyblue']
        			    }
        			},
        			series: [
        			    {
        			        name: '关中洁净煤配送站统计',
        			        type: 'map',
        			        mapType: 'HK', // 自定义扩展图表类型
        			        itemStyle:{
        			            normal:{label:{show:true}},
        			            emphasis:{label:{show:true}}
        			        },
        			        data:brower,
        			        }
        			    ]
        			};
        	//myChart2.setOption(optionMap2);//选项卡二地图数据
        }
	});
	
}

function getCharsDataTwo(city){
	$.ajax({
        type: "post",
        url: basePath+'/service/smzl/api/getCoalData?city='+encodeURI(city),
        async: false,
        dataType: "json",
        success: function (map) {
        	
        	var numZ = '<font color="#007CD7" size="4px">'+map.data[0].count+'</font>';
        	$("#numZ2").append(numZ);
        	var numQi = '<font color="#42C88C" size="4px">'+map.data[0].qi+'</font>';
        	$("#numQi2").append(numQi);
        	var numDian = '<font color="#96C93E" size="4px">'+map.data[0].dian+'</font>';
        	$("#numDian2").append(numDian);
        	var numJie = '<font color="#00B4D5" size="4px">'+map.data[0].jie+'</font>';
        	$("#numJie2").append(numJie);
        }
    });
}

// 点击市区获得区县级echars数据
function getCountyData(city){
	$.ajax({
        type: "post",
        url: basePath+'/service/smzl/api/getCountyData?city='+encodeURI(city),
        async: false,
        dataType: "json",
        success: function (map) {
        	var brower = []; 
        	$.each(map.data,function(i,item){
        		brower.push({
			                     name: item.district,
			                     value: item.count
			              	});
        	});
        	
        	optionCountyMap = {
				tooltip: {
		             trigger: 'item',
		             formatter: function (params) {
		            	 if(params.value){
		            		 return params.seriesName + '<br/>' + params.name + ' : ' + params.value;
		            	 }else{
		            		 return params.seriesName + '<br/>' + params.name + ' : ' + '0';
		            	 }
		             }
		         },
				visualMap: {
					//type: 'piecewise',                  // 定义为分段型 visualMap
			        //splitNumber:5,
				    show:false, 
				    min: 0,
				    max: 5000,
				    text:['高','低'],
				    realtime: false,
				    calculable: true,
				    inRange: {
				        color: ['orangered','yellow', 'lightskyblue']
				    }
				},
				series: [
				    {
				        name: '关中清洁能源用户统计',
				        type: 'map',
				        mapType: 'HK', // 自定义扩展图表类型
				        itemStyle:{
				            normal:{label:{show:true}},
				            emphasis:{label:{show:true}}
				        },
				        data:brower,
				        }
				    ]
				};
        	
        }
    });
}